<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>RegExp</title>
    <script>
    var reg = new RegExp("\w{6,12}");
    var reg2 = /^\w{6,12}$/;
    /*alert(reg);
    alert(reg2);*/
    var username = "zhangsan";
    var flag = reg2.test(username);
    alert(flag);
</script>
</head>
<body>

</body>
</html>